package zuoye.test4;

public class Test {
    public static void main(String[] args) {
        Dog d1 = new Dog(10);
        d1.eat();
        d1.drink();
        Frog f1 = new Frog(5);
        f1.eat();
        f1.drink();
        Sheep s1 = new Sheep(2);
        s1.eat();
        s1.drink();

        Breeder breeder = new Breeder();
        breeder.Swiming(d1);
        breeder.Swiming(f1);


    }

    public void test1(Animal animal) {
        if (animal instanceof Dog) {
            Dog d1 = (Dog) animal;
            d1.swimming();

        } else if (animal instanceof Frog) {
            Frog f1 = (Frog) animal;
            f1.swimming();


        }
    }
}














